package com.example.rubbish.Utils;

import android.graphics.Bitmap;
import android.util.Base64;

import java.io.ByteArrayOutputStream;

public class Base64Utils {
    public   static String bitmapToBase64(Bitmap bitmap , int bitmapQuality){
        String string = null;
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.PNG,bitmapQuality,byteArrayOutputStream);
        byte[] bytes = byteArrayOutputStream.toByteArray();
        string = Base64.encodeToString(bytes,Base64.DEFAULT);
        return  string;
    }


}
